<!DOCTYPE html>
<html><head>
<script type="text/javascript">
function createPageList() {
    var xhr = new XMLHttpRequest;
    xhr.open("GET", "/pagelist.json");
    xhr.onload = function(e) {
        if (xhr.status == 200) {
            var pages = JSON.parse(xhr.responseText);
            if (pages.length)
                document.getElementById("noPageNotice").style.display = "none";

            var pageList = document.createElement("ol");
            for (var i in pages) {
                var link = document.createElement("a");
                var title = pages[i].title ? pages[i].title : ("Page " + (Number(pages[i].id)));
                var url = pages[i].url;
                link.appendChild(document.createTextNode(title + (url ? (" [" + url + "]") : "" )));
                link.setAttribute("href", pages[i].inspectorUrl);
                var pageListItem = document.createElement("li");
                pageListItem.appendChild(link);
                pageList.appendChild(pageListItem);
            }
            document.body.appendChild(pageList);
        }
    };
    xhr.send();
}

document.addEventListener("DOMContentLoaded", createPageList, false);
</script>
</head><body>
<h1>Inspectable web views</h1>
<p id="noPageNotice" style="color:grey">None found, make sure that you have set the developerExtrasEnabled preference property on your WebView.</p>
</body></html>
